/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * HoldAdminPanel.java
 *
 * Created on May 7, 2012, 1:30:12 PM
 */
package view;

/**
 *
 * @author Marc
 */
public class HoldAdminPanel extends javax.swing.JPanel {

    /** Creates new form HoldAdminPanel */
    public HoldAdminPanel() {
        initComponents();
        
        jList2.setEnabled(false);
        jButton2.setEnabled(false);
        jButton3.setEnabled(false);
        jTextField2.setEnabled(false);
        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jList2 = new javax.swing.JList();
        jButton2 = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();
        jComboBox1 = new javax.swing.JComboBox();

        setLayout(null);

        jLabel1.setText("Vælg Hold:");
        add(jLabel1);
        jLabel1.setBounds(22, 21, 70, 14);

        jLabel2.setText("Elever på holdet:");
        add(jLabel2);
        jLabel2.setBounds(20, 90, 82, 14);

        jScrollPane2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

        jList2.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "ELEVER DER ER PÅ DET VALGTE HOLD" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jList2.setToolTipText("");
        jList2.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                jList2ValueChanged(evt);
            }
        });
        jScrollPane2.setViewportView(jList2);

        add(jScrollPane2);
        jScrollPane2.setBounds(20, 110, 240, 320);

        jButton2.setText("Slet hold");
        add(jButton2);
        jButton2.setBounds(20, 450, 80, 20);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Opret nyt hold"));
        jPanel1.setLayout(null);

        jLabel4.setText("Hold ID:");
        jPanel1.add(jLabel4);
        jLabel4.setBounds(60, 70, 70, 14);

        jTextField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField1ActionPerformed(evt);
            }
        });
        jPanel1.add(jTextField1);
        jTextField1.setBounds(108, 63, 108, 20);

        jLabel5.setText("Oprettelsesår:");
        jPanel1.add(jLabel5);
        jLabel5.setBounds(30, 100, 70, 14);

        jTextField2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField2ActionPerformed(evt);
            }
        });
        jPanel1.add(jTextField2);
        jTextField2.setBounds(110, 100, 80, 20);

        jButton3.setText("Opret hold");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });
        jPanel1.add(jButton3);
        jButton3.setBounds(80, 150, 120, 40);

        add(jPanel1);
        jPanel1.setBounds(520, 100, 280, 240);

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Hold1", "Hold2" }));
        add(jComboBox1);
        jComboBox1.setBounds(20, 40, 120, 20);
    }// </editor-fold>//GEN-END:initComponents

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed

        
        // Efter holdet er gemt 
        jTextField1.setText("");
        jTextField2.setText("");
        jTextField2.setEnabled(false);
        jButton3.setEnabled(false);
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
        jTextField2.setEnabled(true);
    }//GEN-LAST:event_jTextField1ActionPerformed

    private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed
        jButton3.setEnabled(true);
    }//GEN-LAST:event_jTextField2ActionPerformed

    private void jList2ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList2ValueChanged
    }//GEN-LAST:event_jList2ValueChanged

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JList jList2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    // End of variables declaration//GEN-END:variables
}
